//
//  KZSingleChoiceView.m
//  lg_zhinengbeikao_english
//
//  Created by 朱凯 on 2018/12/19.
//  Copyright © 2018年 zhukai. All rights reserved.
//

#import "KZSingleChoiceView.h"

#import "KZOptionPanelView.h"
#import "KZWkSubjectView.h"


@interface KZSingleChoiceView ()
@end

@implementation KZSingleChoiceView
{
    KZWkSubjectView *_subjectView;          // 题干
    KZOptionPanelView *_optionPanelView;    // 选项面板
}

- (instancetype)init {
    if (self = [super init]) {
        
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    
    _subjectView = [[KZWkSubjectView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH - 20, 1)];
    __weak typeof(self) wself = self;
    _subjectView.contentHeightDidUpdate = ^(CGFloat bottom) {
        __strong typeof(self) ssefl = wself;
        [ssefl->_optionPanelView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(bottom + 20);
        }];
    };
    [self addSubview:_subjectView];
    _subjectView.content = @"这个协议中有两个参数一个是WKUserContentController,一个是WKScriptMessage,WKUserContentController负责将WKScriptMessage调度出来,因此要是实现JS...";
    
    
    _optionPanelView = [KZOptionPanelView new];
    [self addSubview:_optionPanelView];
    [_optionPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self->_subjectView.mas_bottom).offset(20);
        make.left.right.mas_equalTo(0);
        // 设置父视图高度
        make.bottom.equalTo(@0);
    }];
    _optionPanelView.options = @{@"A": @"Hello",
                                 @"B": @"I like fishing.",
                                 @"C": @"Are you 18 years old?",
                                 @"D": @"How are you?",
                                 };
}


@end
